home *** CD-ROM | disk | FTP | other *** search
- Path: mail2news.demon.co.uk!genesis.demon.co.uk
- From: Lawrence Kirby <fred@genesis.demon.co.uk>
- Newsgroups: comp.lang.c
- Subject: Re: Is This Bad Coding Practice?
- Date: Mon, 01 Apr 96 21:51:03 GMT
- Organization: none
- Message-ID: <828395463snz@genesis.demon.co.uk>
- References: <4jgnt2$9d1@loki.tor.hookup.net> <828135115snz@genesis.demon.co.uk> <4jjqf1$6c1@loki.tor.hookup.net>
- Reply-To: fred@genesis.demon.co.uk
- X-NNTP-Posting-Host: genesis.demon.co.uk
- X-Newsreader: Demon Internet Simple News v1.27
- X-Mail2News-Path: genesis.demon.co.uk
-
- In article <4jjqf1$6c1@loki.tor.hookup.net>
- Rajendra_Singh@msn.com "Rajendra Singh" writes:
-
- >Lawrence Kirby <fred@genesis.demon.co.uk> wrote:
- >
- >>No, as soon as func1 returns test doesn't exist any more so you cannot
- >>safely access it (doing so results in undefined behaviour). Don't
- >>do it, even if it seems to work on your system - it will bite you, sooner
- >>rather than later if you're lucky.
- >
- >I was working with a company and one of the senior programmers had
- >this piece of code in production. When I questioned him about it, he
- >says that it will always work.
-
- I'd be worried if this was his general attitude towards software development,
- especially in production code.
-
- > I had my doubts, that's why I was
- >curious as to whether or not it would always work.
-
- In a real sense it doesn't matter whether any implementations exist where
- that particular piece of code fails. The code is a maintenance nightmare
- because it doesn't mean anything - it has no well defined bevahiour. If
- you're trying to debug code with such things liberally sprinked through it
- any one of them could be the cause of trouble, it makes the whole process
- much more difficult.
-
- >By the way, the forementioned piece of code worked on AIX, SCO, HPUX,
- >and OS/2.
-
- I assume that the code to test this was different since that posted doesn't
- output any verifyable results.
-
- --
- -----------------------------------------
- Lawrence Kirby | fred@genesis.demon.co.uk
- Wilts, England | 70734.126@compuserve.com
- -----------------------------------------
-